home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Libraries / BlobMgr / Library Folder / Move.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-21  |  1.5 KB  |  62 lines  |  [TEXT/KAHL]

  1. # include    "BlobMgr.h"
  2.  
  3.  
  4. /* -------------------------------------------------------------------- */
  5. /*                            Blob Movement Operations                    */
  6. /* -------------------------------------------------------------------- */
  7.  
  8.  
  9. /*
  10.  * Offset a blob or part of a blob by (hoff, voff).    If the blob is enabled,
  11.  * hide it and redraw at the new location.
  12.  */
  13.  
  14. pascal void
  15. OffsetBlob (BlobHandle b, short partCode, short hoff, short voff)
  16. {
  17. Boolean    vis;
  18.  
  19.     if ((hoff == 0) && (voff == 0)) return;    /* avoid unnecessary redraw */
  20.  
  21.     vis = false;
  22.     if (BlobEnabled (b))
  23.     {
  24.         vis = true;
  25.         HideBlob (b);
  26.     }
  27.  
  28.     if ((partCode == inDragBlob) || (partCode == inFullBlob))
  29.         OffsetRgn ((**b).dragRgn, hoff, voff);
  30.     if ((partCode == inStatBlob) || (partCode == inFullBlob))
  31.         OffsetRgn ((**b).statRgn, hoff, voff);
  32.  
  33.     if (vis)
  34.         ShowBlob (b);
  35. }
  36.  
  37.  
  38. /*
  39.  * Move a blob or part of a blob to (h, v).    If the blob is enabled,
  40.  * hide it and redraw at the new location.    If partCode is inDragBlob
  41.  * or inStatBlob, move the appropriate region to the location.    If
  42.  * inFullBlob, move both regions in synchrony so static region is at
  43.  * given location, drag region is at same location relative to the
  44.  * static region as it was before.
  45.  */
  46.  
  47. pascal void
  48. MoveBlob (BlobHandle b, short partCode, short h, short v)
  49. {
  50.     if (partCode == inDragBlob)
  51.     {
  52.         h -= (**((**b).dragRgn)).rgnBBox.left;    /* convert to offsets */
  53.         v -= (**((**b).dragRgn)).rgnBBox.top;
  54.     }
  55.     else    /* it's inStatBlob or inFullBLob */
  56.     {
  57.         h -= (**((**b).statRgn)).rgnBBox.left;
  58.         v -= (**((**b).statRgn)).rgnBBox.top;
  59.     }
  60.     OffsetBlob (b, partCode, h, v);
  61. }
  62.